#导入
import tensorflow as tf
from tensorflow import keras 

import numpy as np
import matplotlib.pyplot as plt

#加载数据
mnist = keras.datasets.fashion_mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()

#数据预处理 根据模型和数据
x_train, x_test = x_train/255, x_test/255

#构建模型
model = keras.Sequential([
    keras.layers.Flatten(input_shape=(28,28)),
    keras.layers.Dense(128,activation='relu')
    keras.layers.Dense(10)

])

model.compile(
    optimizer='adam',
    loss='tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)',
    metrics=['accuracy']
)

#模型训练
model.fit(x_train, y_train, epochs=10)

#模型测试
model.evaluate(x_test, y_test)

#预测
probability_model = keras.Sequential([
    model,
    keras.layers.Softmax()
])

predictions = probability_model.predict(test_images)













